package com.fanpan26.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;


/**
 * @author fanpan26
 */
@Component
@Aspect
public class AopConfig {

    @Pointcut("execution(* com.fanpan26.aop.*.*(..))")
    private void pointcut(){}

    @Before("pointcut()")
    public void before(){
        System.out.println("before");
    }

    @Around("pointcut()")
    public void around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("around before");
        joinPoint.proceed();
        System.out.println("around after");
    }

    @After("pointcut()")
    public  void after(JoinPoint joinPoint){
        System.out.println("after");
    }

}
